using System;
using System.Web.UI;

namespace Altairis.FluffyCloud.WebCore.DynamicData.FieldTemplates {

    public partial class EmailAddressField : System.Web.DynamicData.FieldTemplateUserControl {

        public override Control DataControl {
            get {
                return HyperLink1;
            }
        }

        protected override void OnDataBinding(EventArgs e) {
            string url = FieldValueString;
            if (!url.StartsWith("mailto:", StringComparison.CurrentCultureIgnoreCase)) {
                url = "mailto:" + url;
            }
            HyperLink1.NavigateUrl = url;
        }
    }
}